home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Tool Chest / Interfaces / MPW Interfaces / CIncludes / Fonts.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-17  |  6.4 KB  |  275 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Fonts.h
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. */
  11.  
  12. #ifndef __FONTS__
  13. #define __FONTS__
  14.  
  15. #ifndef __TYPES__
  16. #include <Types.h>
  17. #endif
  18.  
  19.  
  20. enum {
  21.  
  22.  systemFont = 0,
  23.  applFont = 1,
  24.  newYork = 2,
  25.  geneva = 3,
  26.  monaco = 4,
  27.  venice = 5,
  28.  london = 6,
  29.  athens = 7,
  30.  sanFran = 8,
  31.  toronto = 9,
  32.  cairo = 11,
  33.  losAngeles = 12,
  34.  times = 20,
  35.  helvetica = 21,
  36.  courier = 22,
  37.  symbol = 23,
  38.  mobile = 24,
  39.  commandMark = 17,
  40.  checkMark = 18,
  41.  diamondMark = 19
  42. };
  43. enum {
  44.  appleMark = 20,
  45.  propFont = 36864,
  46.  prpFntH = 36865,
  47.  prpFntW = 36866,
  48.  prpFntHW = 36867,
  49.  fixedFont = 45056,
  50.  fxdFntH = 45057,
  51.  fxdFntW = 45058,
  52.  fxdFntHW = 45059,
  53.  fontWid = 44208
  54. };
  55.  
  56. struct FMInput {
  57.  short family;
  58.  short size;
  59.  Style face;
  60.  Boolean needBits;
  61.  short device;
  62.  Point numer;
  63.  Point denom;
  64. };
  65.  
  66. typedef struct FMInput FMInput;
  67.  
  68. struct FMOutput {
  69.  short errNum;
  70.  Handle fontHandle;
  71.  unsigned char boldPixels;
  72.  unsigned char italicPixels;
  73.  unsigned char ulOffset;
  74.  unsigned char ulShadow;
  75.  unsigned char ulThick;
  76.  unsigned char shadowPixels;
  77.  char extra;
  78.  unsigned char ascent;
  79.  unsigned char descent;
  80.  unsigned char widMax;
  81.  char leading;
  82.  char unused;
  83.  Point numer;
  84.  Point denom;
  85. };
  86.  
  87. typedef struct FMOutput FMOutput;
  88. typedef FMOutput *FMOutPtr;
  89.  
  90. struct FontRec {
  91.  short fontType;        /*font type*/
  92.  short firstChar;        /*ASCII code of first character*/
  93.  short lastChar;        /*ASCII code of last character*/
  94.  short widMax;            /*maximum character width*/
  95.  short kernMax;            /*negative of maximum character kern*/
  96.  short nDescent;        /*negative of descent*/
  97.  short fRectWidth;        /*width of font rectangle*/
  98.  short fRectHeight;        /*height of font rectangle*/
  99.  short owTLoc;            /*offset to offset/width table*/
  100.  short ascent;            /*ascent*/
  101.  short descent;            /*descent*/
  102.  short leading;            /*leading*/
  103.  short rowWords;        /*row width of bit image / 2 */
  104. };
  105.  
  106. typedef struct FontRec FontRec;
  107.  
  108. struct FMetricRec {
  109.  Fixed ascent;            /*base line to top*/
  110.  Fixed descent;            /*base line to bottom*/
  111.  Fixed leading;            /*leading between lines*/
  112.  Fixed widMax;            /*maximum character width*/
  113.  Handle wTabHandle;        /*handle to font width table*/
  114. };
  115.  
  116. typedef struct FMetricRec FMetricRec;
  117.  
  118. struct WidEntry {
  119.  short widStyle;        /*style entry applies to*/
  120. };
  121.  
  122. typedef struct WidEntry WidEntry;
  123.  
  124. struct WidTable {
  125.  short numWidths;        /*number of entries - 1*/
  126. };
  127.  
  128. typedef struct WidTable WidTable;
  129.  
  130. struct AsscEntry {
  131.  short fontSize;
  132.  short fontStyle;
  133.  short fontID;            /*font resource ID*/
  134. };
  135.  
  136. typedef struct AsscEntry AsscEntry;
  137.  
  138. struct FontAssoc {
  139.  short numAssoc;        /*number of entries - 1*/
  140. };
  141.  
  142. typedef struct FontAssoc FontAssoc;
  143.  
  144. struct StyleTable {
  145.  short fontClass;
  146.  long offset;
  147.  long reserved;
  148.  char indexes[48];
  149. };
  150.  
  151. typedef struct StyleTable StyleTable;
  152.  
  153. struct NameTable {
  154.  short stringCount;
  155.  Str255 baseFontName;
  156. };
  157.  
  158. typedef struct NameTable NameTable;
  159.  
  160. struct KernPair {
  161.  char kernFirst;        /*1st character of kerned pair*/
  162.  char kernSecond;        /*2nd character of kerned pair*/
  163.  short kernWidth;        /*kerning in 1pt fixed format*/
  164. };
  165.  
  166. typedef struct KernPair KernPair;
  167.  
  168. struct KernEntry {
  169.  short kernLength;        /*length of this entry*/
  170.  short kernStyle;        /*style the entry applies to*/
  171. };
  172.  
  173. typedef struct KernEntry KernEntry;
  174.  
  175. struct KernTable {
  176.  short numKerns;        /*number of kerning entries*/
  177. };
  178.  
  179. typedef struct KernTable KernTable;
  180.  
  181. struct WidthTable {
  182.  Fixed tabData[256];    /*character widths*/
  183.  Handle tabFont;        /*font record used to build table*/
  184.  long sExtra;            /*space extra used for table*/
  185.  long style;            /*extra due to style*/
  186.  short fID;                /*font family ID*/
  187.  short fSize;            /*font size request*/
  188.  short face;            /*style (face) request*/
  189.  short device;            /*device requested*/
  190.  Point inNumer;            /*scale factors requested*/
  191.  Point inDenom;            /*scale factors requested*/
  192.  short aFID;            /*actual font family ID for table*/
  193.  Handle fHand;            /*family record used to build up table*/
  194.  Boolean usedFam;        /*used fixed point family widths*/
  195.  unsigned char aFace;    /*actual face produced*/
  196.  short vOutput;            /*vertical scale output value*/
  197.  short hOutput;            /*horizontal scale output value*/
  198.  short vFactor;            /*vertical scale output value*/
  199.  short hFactor;            /*horizontal scale output value*/
  200.  short aSize;            /*actual size of actual font used*/
  201.  short tabSize;            /*total size of table*/
  202. };
  203.  
  204. typedef struct WidthTable WidthTable;
  205.  
  206. struct FamRec {
  207.  short ffFlags;            /*flags for family*/
  208.  short ffFamID;            /*family ID number*/
  209.  short ffFirstChar;        /*ASCII code of 1st character*/
  210.  short ffLastChar;        /*ASCII code of last character*/
  211.  short ffAscent;        /*maximum ascent for 1pt font*/
  212.  short ffDescent;        /*maximum descent for 1pt font*/
  213.  short ffLeading;        /*maximum leading for 1pt font*/
  214.  short ffWidMax;        /*maximum widMax for 1pt font*/
  215.  long ffWTabOff;        /*offset to width table*/
  216.  long ffKernOff;        /*offset to kerning table*/
  217.  long ffStylOff;        /*offset to style mapping table*/
  218.  short ffProperty[9];    /*style property info*/
  219.  short ffIntl[2];        /*for international use*/
  220.  short ffVersion;        /*version number*/
  221. };
  222.  
  223. typedef struct FamRec FamRec;
  224.  
  225.  
  226. #ifdef __cplusplus
  227. extern "C" {
  228. #endif
  229. pascal void InitFonts(void)
  230.  = 0xA8FE; 
  231. pascal void GetFontName(short familyID,Str255 name)
  232.  = 0xA8FF; 
  233. pascal void GetFNum(ConstStr255Param name,short *familyID)
  234.  = 0xA900; 
  235. pascal Boolean RealFont(short fontNum,short size)
  236.  = 0xA902; 
  237. pascal void SetFontLock(Boolean lockFlag)
  238.  = 0xA903; 
  239. pascal FMOutPtr FMSwapFont(const FMInput *inRec)
  240.  = 0xA901; 
  241. pascal void SetFScaleDisable(Boolean fscaleDisable)
  242.  = 0xA834; 
  243. pascal void FontMetrics(const FMetricRec *theMetrics)
  244.  = 0xA835; 
  245. pascal void SetFractEnable(Boolean fractEnable); 
  246. pascal Boolean IsOutline(Point numer,Point denom)
  247.  = {0x7000,0xA854}; 
  248. pascal void SetOutlinePreferred(Boolean outlinePreferred)
  249.  = {0x7001,0xA854}; 
  250. pascal Boolean GetOutlinePreferred(void)
  251.  = {0x7009,0xA854}; 
  252. pascal OSErr OutlineMetrics(short byteCount,const void *textPtr,Point numer,
  253.  Point denom,short *yMax,short *yMin,FixedPtr awArray,FixedPtr lsbArray,
  254.  RectPtr boundsArray)
  255.  = {0x7008,0xA854}; 
  256. pascal void SetPreserveGlyph(Boolean preserveGlyph)
  257.  = {0x700A,0xA854}; 
  258. pascal Boolean GetPreserveGlyph(void)
  259.  = {0x700B,0xA854}; 
  260. pascal OSErr FlushFonts(void)
  261.  = {0x700C,0xA854}; 
  262. void getfnum(char *theName,short *familyID); 
  263. void getfontname(short familyID,char *theName); 
  264.  
  265. pascal short GetDefFontSize(void)
  266.  = {0x3EB8,0x0BA8,0x6604,0x3EBC,0x000C}; 
  267. #define GetSysFont() (* (short*) 0x0BA6)
  268. #define GetAppFont() (* (short*) 0x0984)
  269.  
  270. #ifdef __cplusplus
  271. }
  272. #endif
  273.  
  274. #endif
  275.